/**
 * 清除空格
 * 
 * @param targetCmpId
 * @returns
 */
function trimStr(targetCmpId) {
	return $("#" + targetCmpId).val().replace(/(^\s*)|(\s*$)/g, "");
}
/**
 * Ajax请求会话过期提示
 */
function timeoutAlert() {
	art.dialog.open("/sacw/common/user_login.jsp", {
		title : "会话过期",
		lock : true,
		width : 290,
		height : 115,
		fixed : true,
		button:[{name:'重新登录',callback:function(){
				this.iframe.contentWindow.login();
				return false;
			}},{name:'退出系统',callback:function(){
				this.iframe.contentWindow.exitSys();
				return false;
			}}
		]
	});
}
/**
 * Ajax会话过期全局设置
 */
$(function() {
	$.ajaxSetup({
		contentType : "application/x-www-form-urlencoded",
		cache : false,
		dataType:"json",
		complete : function(XMLHttpRequest, status) {
			var txt = XMLHttpRequest.responseText;
			if (txt != null && txt != "") {
				var res = eval("(" + txt + ")");
				if (0 == res.sessionState) {
					timeoutAlert();
				}
			}
		}
	});
});


